﻿@model PagedList<BetSheet>
@using LotteryVoteMVC.Core
@using LotteryVoteMVC.Core.Application
@using LotteryVoteMVC.Models
@using LotteryVoteMVC.Resources
@using LotteryVoteMVC.Utility
@{
    ViewBag.Title = @Resource.BetSheetList;
    Layout = "~/Views/Shared/Main.cshtml";
}
@section Header
{
    <script src="@Url.Content("~/Scripts/Customer/SearchHelper.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/TableBase.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/TableBase.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Pager/pagerGray.css")" rel="stylesheet" type="text/css" />
}
@{int index = 1;}
<div id="searchBar">
    @using (Html.BeginForm())
    {
        <span>@Resource.UserName</span>
        @Html.TextBox("UserName")
        <span>@Resource.Num</span>
        @Html.TextBox("Num")
        <input type="submit" name="search" id="search" value="@Resource.Search" />
    }
</div>
<table>
    <thead>
        <tr>
            <td>
                @Resource.No
            </td>
            <td>
                @Resource.SheetNum
            </td>
            <td>
                @Resource.UserName
            </td>
            <td>
                @Resource.Num
            </td>
            <td>
                @Resource.Company
            </td>
            <td>
                @Resource.Turnover
            </td>
            <td>
                @Resource.Commission
            </td>
            <td>
                @Resource.NetAmount
            </td>
            <td>
                @Resource.IPAddress
            </td>
            <td>
                @Resource.Time
            </td>
            <td>
                @Resource.Function
            </td>
        </tr>
    </thead>
    <tbody>
        @foreach (var sheet in Model)
        { 
            <tr>
                <td>
                    @(index++)
                </td>
                <td>
                    @sheet.SheetId
                </td>
                <td>
                    @sheet.User.UserName
                </td>
                <td>
                    <strong>
                        @sheet.Num
                    </strong>
                </td>
                <td>
                    @sheet.BetCompany
                </td>
                <td>
                    @sheet.Turnover.ToString("N")
                </td>
                <td>
                    @sheet.Commission.ToString("N")
                </td>
                <td>
                    @sheet.NetAmount.ToString("N")
                </td>
                <td>
                    @sheet.IPAddress
                </td>
                <td>
                    @sheet.CreateTime
                </td>
                <td>
                    @Html.ActionLink(Resource.Detail, "Sheet", "Order", new { Id = sheet.SheetId }, null)
                    @if (ViewBag.User.Role == Role.Company)
                    { 
                        @Html.ActionLink(Resource.Cancel, "Cancel", "Sheet", new { Id = sheet.SheetId }, new { onclick = "return confirm('Are you sure?')" })
                    }
                </td>
            </tr>
        }
    </tbody>
</table>
@Html.Pager(Model)
